home *** CD-ROM | disk | FTP | other *** search
- extern struct Screen *OpenScreen();
-
- extern struct TextAttr Topaz80;
-
- void itoa();
-
- /* The Gadgets */
-
- static struct Gadget FileReqGadg =
- {
- NULL,
- 9,159,
- 212,19,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_FILEREQ,
- BORDER(BOOLBORDER,2,1,0)
- };
-
- static struct StringInfo FileSInfo =
- {
- NULL,
- NULL,
- 0,
- 32,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget FileGadg =
- {
- &FileReqGadg,
- 55,146,
- 253,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&FileSInfo,
- ID_FILE,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct Gadget Current2Gadg =
- {
- &FileGadg,
- 436,129,
- 69,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_CURRENT2,
- BORDER(FILLEDBORDER,2,1,0)
- };
-
- static struct Gadget Current1Gadg =
- {
- &Current2Gadg,
- 436,100,
- 69,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_CURRENT1,
- BORDER(FILLEDBORDER,2,1,0)
- };
-
- static struct StringInfo Drawer2SInfo =
- {
- NULL,
- NULL,
- 0,
- 160,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget Drawer2Gadg =
- {
- &Current1Gadg,
- 77,131,
- 343,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&Drawer2SInfo,
- ID_DRAWER2,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct StringInfo Drawer1SInfo =
- {
- NULL,
- NULL,
- 0,
- 160,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget Drawer1Gadg =
- {
- &Drawer2Gadg,
- 77,102,
- 343,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&Drawer1SInfo,
- ID_DRAWER1,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct Gadget Auto2Gadg =
- {
- &Drawer1Gadg,
- 112,115,
- 78,12,
- GADGHNONE,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_AUTO2,
- BORDER(FILLEDBORDER,2,1,3)
- };
-
- static struct Gadget Auto1Gadg =
- {
- &Auto2Gadg,
- 112,86,
- 78,12,
- GADGHNONE,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_AUTO1,
- BORDER(FILLEDBORDER,2,1,3)
- };
-
- static struct Gadget InfoGadg =
- {
- &Auto1Gadg,
- 391,71,
- 114,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_INFO,
- BORDER(CYCLEIMG+FILLEDBORDER,2,1,0)
- };
-
- static struct StringInfo HideSInfo =
- {
- NULL,
- NULL,
- 0,
- 32,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget HideGadg =
- {
- &InfoGadg,
- 229,73,
- 93,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&HideSInfo,
- ID_HIDE,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct StringInfo ShowSInfo =
- {
- NULL,
- NULL,
- 0,
- 32,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget ShowGadg =
- {
- &HideGadg,
- 61,73,
- 93,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&ShowSInfo,
- ID_SHOW,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct Gadget DirectroyGadg =
- {
- &ShowGadg,
- 391,57,
- 114,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_DIRECTORY,
- BORDER(CYCLEIMG+FILLEDBORDER,2,1,0)
- };
-
- static UBYTE TopEdgeBuff[5];
- static struct StringInfo TopEdgeSInfo =
- {
- TopEdgeBuff,
- NULL,
- 0,
- 5,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget TopEdgeGadg =
- {
- &DirectroyGadg,
- 221,59,
- 41,8,
- GADGHCOMP,
- RELVERIFY+LONGINT,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&TopEdgeSInfo,
- ID_TOPEDGE,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static UBYTE LeftEdgeBuff[5];
- static struct StringInfo LeftEdgeSInfo =
- {
- LeftEdgeBuff,
- NULL,
- 0,
- 5,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget LeftEdgeGadg =
- {
- &TopEdgeGadg,
- 93,59,
- 41,8,
- GADGHCOMP,
- RELVERIFY+LONGINT,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&LeftEdgeSInfo,
- ID_LEFTEDGE,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static UBYTE OKTextBuff[9]="go on";
- static struct StringInfo OKTextSInfo =
- {
- OKTextBuff,
- NULL,
- 0,
- 9,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget OKTextGadg =
- {
- &LeftEdgeGadg,
- 427,45,
- 75,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&OKTextSInfo,
- ID_OKTEXT,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static UBYTE TitleBuff[54]="The multitasking FileRequester © by Andreas Krebs";
- static struct StringInfo TitleSInfo =
- {
- TitleBuff,
- NULL,
- 0,
- 54,
- 0,
- 0,0,0,0,0,
- 0,
- 0,
- NULL
- };
-
- static struct Gadget TitleGadg =
- {
- &OKTextGadg,
- 69,45,
- 253,8,
- GADGHCOMP,
- RELVERIFY,
- STRGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- (APTR)&TitleSInfo,
- ID_TITLE,
- BORDER(FILLEDSTRBORDER,2,1,0)
- };
-
- static struct Gadget ScrModeGadg =
- {
- &TitleGadg,
- 349,29,
- 83,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_SCRMODE,
- BORDER(CYCLEIMG+FILLEDBORDER,2,1,0)
- };
-
- struct Gadget ScreenGadg =
- {
- &ScrModeGadg,
- 74,29,
- 83,12,
- GADGHCOMP,
- RELVERIFY,
- BOOLGADGET,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ID_SCREEN,
- BORDER(CYCLEIMG+FILLEDBORDER,2,1,0)
- };
-
-
- /* My texts */
-
- static UBYTE DrawerTxt[]="Drawer:";
- static UBYTE CurrentTxt[]="Current:";
-
- static struct MRText MyTexts[]=
- {
- { 8, 25, 2, 36, (UBYTE *)"Define parameters for FileRequester:" },
- { 14, 37, 1, 7, (UBYTE *)"Screen:" },
- { 193, 37, 1, 19, (UBYTE *)"Custom screen mode:" },
- { 384, 37, 1, 4, (UBYTE *)"Lace" },
- { 14, 51, 1, 6, (UBYTE *)"Title:" },
- { 340, 51, 1, 10, (UBYTE *)"Okay text:" },
- { 14, 65, 1, 9, (UBYTE *)"LeftEdge:" },
- { 150, 65, 1, 8, (UBYTE *)"TopEdge:" },
- { 323, 65, 2, 8, (UBYTE *)"Display:" },
- { 418, 65, 1, 9, (UBYTE *)"Directory" },
- { 14, 79, 1, 5, (UBYTE *)"Show:" },
- { 182, 79, 1, 5, (UBYTE *)"Hide:" },
- { 458, 79, 1, 5, (UBYTE *)".info" },
- { 8, 94, 2, 11, (UBYTE *)"Directory1:" },
- { 14, 108, 1, 7, (UBYTE *)DrawerTxt },
- { 443, 108, 1, 7, (UBYTE *)CurrentTxt },
- { 8, 123, 2, 11, (UBYTE *)"Directory2:" },
- { 14, 137, 1, 7, (UBYTE *)DrawerTxt },
- { 443, 137, 1, 7, (UBYTE *)CurrentTxt },
- { 8, 152, 2, 5, (UBYTE *)"File:" },
- { 40, 171, 2, 19, (UBYTE *)"Start FileRequester" },
- { 297, 171, 2, 14, (UBYTE *)"Return status:" },
- { 8, 190, 2, 9, (UBYTE *)"Selected:" },
- { -1, -1, -1, -1, (UBYTE *)-1L } /* no further entries */
- };
-
- void SetGadgetBuffers(fr)
- register struct FileReq *fr;
- {
- FileSInfo.Buffer=fr->FileBuff;
- ShowSInfo.Buffer=fr->ShowBuff;
- HideSInfo.Buffer=fr->HideBuff;
-
- Drawer1SInfo.Buffer=fr->FileList[0].DrawerBuff;
- StrCpy((UBYTE *)"SYS:",Drawer1SInfo.Buffer);
- fr->FileList[0].AutoRead=DO_AUTOREAD;
-
- Drawer2SInfo.Buffer=fr->FileList[1].DrawerBuff;
- GetCurrentPath(Drawer2SInfo.Buffer);
- fr->FileList[1].AutoRead=DO_AUTOREAD;
-
- fr->TitleString=TitleBuff;
- fr->OkayString=OKTextBuff;
- }
-
- void GetCurrent(win,fr,num)
- register struct Window *win;
- register struct FileReq *fr;
- {
- GetCurrentPath(fr->FileList[num].DrawerBuff);
-
- if(!num)
- RefreshGList(&Drawer1Gadg,win,NULL,1L);
- else
- RefreshGList(&Drawer2Gadg,win,NULL,1L);
- }
-
- void CreateDisplay(win,rp)
- register struct Window *win;
- register struct RastPort *rp;
- {
- SetDrMd(rp,JAM1);
- SetAPen(rp,3L);
-
- RectFill(rp,(ULONG)win->BorderLeft,(ULONG)win->BorderTop,
- (ULONG)(win->Width - win->BorderRight -1),
- (ULONG)(win->Height - win->BorderBottom-1));
-
- DrawGadgetBorder(&ScreenGadg,win,-1L);
-
- SetDrMd(rp,JAM1); /* make sure that DrawMode is JAM1 */
- DrawTexts(rp,MyTexts);
- }
-
- static UBYTE ModeTxt[][6]=
- {
- " Lace ",
- "NoLace"
- };
-
- void SetScreenMode(rp,mode)
- register struct RastPort *rp;
- register BOOL mode;
- {
- SetDrMd(rp,JAM2);
- SetAPen(rp,1L);
- SetBPen(rp,0L);
-
- Move(rp,376L,37L);
- Text(rp,ModeTxt[mode],6L);
- }
-
- static UBYTE TypeTxt[][6]=
- {
- "WBench",
- "Custom"
- };
-
- void SetScreenType(win,rp,type,mode)
- register struct Window *win;
- register struct RastPort *rp;
- register BOOL type,mode;
- {
- SetDrMd(rp,JAM2);
- SetAPen(rp,1L);
- SetBPen(rp,0L);
-
- Move(rp,102L,37L);
- Text(rp,TypeTxt[type],6L);
-
- if(type)
- {
- OnGadget(&ScrModeGadg,win,NULL);
- DrawGadgetBorder(&ScrModeGadg,win,1L);
-
- SetScreenMode(rp,mode);
- }
- else
- OffGadget(&ScrModeGadg,win,NULL);
- }
-
- void SetDirectory(rp,num)
- register struct RastPort *rp;
- register UWORD num;
- {
- UBYTE txt;
-
- SetDrMd(rp,JAM2);
- SetAPen(rp,1L);
- SetBPen(rp,0L);
-
- txt=(UBYTE)num+'1';
- Move(rp,490L,65L);
- Text(rp,&txt,1L);
- }
-
- static UBYTE InfoTxt[][4] =
- {
- "Hide",
- "Show"
- };
-
- void SetInfo(rp,info)
- register struct RastPort *rp;
- register BOOL info;
- {
- SetDrMd(rp,JAM2);
- SetAPen(rp,1L);
- SetBPen(rp,0L);
-
- Move(rp,418L,79L);
- Text(rp,InfoTxt[info],4L);
- }
-
- void SetAutoRead(win,rp,gadg,autoread)
- register struct Window *win;
- register struct RastPort *rp;
- register struct Gadget *gadg;
- register BOOL autoread;
- {
- if(autoread)
- gadg->UserData=BORDER(FILLEDBORDER,1,2,0);
- else
- gadg->UserData=BORDER(FILLEDBORDER,2,1,3);
-
- DrawGadgetBorder(gadg,win,1L);
-
- SetDrMd(rp,JAM1);
- SetAPen(rp,(ULONG)(autoread+1));
- Move(rp,(ULONG)(gadg->LeftEdge+7),(ULONG)(gadg->TopEdge+8));
- Text(rp,"AutoRead",8L);
- }
-
- void SetAutoGadgets(win,rp,fr)
- register struct Window *win;
- register struct RastPort *rp;
- register struct FileReq *fr;
- {
- SetAutoRead(win,rp,&Auto1Gadg,fr->FileList[0].AutoRead);
- SetAutoRead(win,rp,&Auto2Gadg,fr->FileList[1].AutoRead);
- }
-
- void SetEdge(win,fr)
- register struct Window *win;
- register struct FileReq *fr;
- {
- itoa(fr->LeftEdge,LeftEdgeBuff);
- LeftEdgeSInfo.LongInt=(ULONG)fr->LeftEdge;
- itoa(fr->TopEdge,TopEdgeBuff);
- TopEdgeSInfo.LongInt=(ULONG)fr->TopEdge;
-
- RefreshGList(&LeftEdgeGadg,win,NULL,2L);
- }
-
- void GetEdge(fr)
- register struct FileReq *fr;
- {
- fr->LeftEdge=(UWORD)LeftEdgeSInfo.LongInt;
- fr->TopEdge=(UWORD)TopEdgeSInfo.LongInt;
- }
-
-
- void itoa(i,s)
- register UWORD i;
- register UBYTE *s;
- {
- register BOOL zero=(BOOL)FALSE;
- register UWORD div;
- register UBYTE digit;
-
- for(div=10000;div>1;div/=10)
- {
- digit=i/div;
- if(zero || digit)
- {
- *s++=digit+'0';
- zero=(BOOL)TRUE;
- }
- i=i%div;
- }
-
- *s++=i+'0';
-
- *s=0;
- }
-
- static struct NewScreen NewTestScreen =
- {
- 0,0,
- 640,400,
- 2,
- 1,3,
- HIRES|LACE,
- CUSTOMSCREEN|SCREENBEHIND,
- &Topaz80,
- (UBYTE *)"Custom screen for multireq.library test program",
- NULL,
- NULL
- };
-
- struct Screen *GetScreen(type,mode)
- register UWORD type,mode;
- {
- register struct Screen *scrn;
-
- if(mode)
- {
- NewTestScreen.Height=200;
- NewTestScreen.ViewModes=HIRES;
- }
- else
- {
- NewTestScreen.Height=400;
- NewTestScreen.ViewModes=HIRES|LACE;
- }
-
- if(type)
- scrn=OpenScreen(&NewTestScreen);
- else
- scrn=NULL;
-
- return(scrn);
- }
-
- static UBYTE StatusTxt[][11] =
- {
- "Error ",
- "Cancel ",
- "Close ",
- "File Return",
- "DoubleClick",
- "Okay "
- };
-
- void WriteStatus(rp,fr)
- register struct RastPort *rp;
- register struct FileReq *fr;
- {
- register UWORD len;
-
- SetDrMd(rp,JAM2);
- SetAPen(rp,1L);
- SetBPen(rp,3L);
-
- Move(rp,417L,171L);
- Text(rp,StatusTxt[fr->ReturnStatus],11L);
-
- SetDrMd(rp,JAM1);
- SetAPen(rp,3L);
- RectFill(rp,88L,183L,506L,191L);
-
- len=StrLen(fr->FileNameBuff);
- if(len>52) len=52;
-
- SetAPen(rp,1L);
- Move(rp,88L,190L);
- Text(rp,fr->FileNameBuff,(ULONG)len);
- }
-
-